#!/usr/bin/env python3

# Copyright (c) 2020-2021 Fpemud <fpemud@sina.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.


import os
from ._policies import Policies


class UserData:

    def __init__(self, prefix="/", user=None, read_only=False):
        self._prefix = prefix
        self._policies = Policies(prefix=self._prefix, read_only=True)
        self._cfgDir = os.path.join(self._prefix, "home", user, ".mozilla", "firefox")          # FIXME: should consider self._policies
        self._profilesIni = os.path.join(self._cfgDir, "profiles.ini")
        self._readOnly = read_only

    @property
    def paths(self):
        # FIXME: parse profiles.ini and add all profile pathes into return value
        return [
            self._cfgDir,
            self._profilesIni,
        ]

    def get_profiles(self):
        # FIXME: return [profile-name]
        assert False

    def get_default_profile(self):
        # FIXME: return profile-name
        assert False

    def set_default_profile(self, profile_name):
        # FIXME
        assert False

    def get_start_with_last_profile(self):
        assert False

    def set_start_with_last_profile(self, value):
        assert False

    def load_profile(self, profile_name):
        # FIXME: return profile object
        assert False

    def create_profile(self, new_profile_name):
        # FIXME: no return
        assert False

    def clone_profile(self, profile_name, new_profile_name):
        # FIXME: no return
        assert False

    def rename_profile(self, profile_name, new_profile_name):
        # FIXME: no return
        assert False

    def delete_profile(self, profile_name):
        # FIXME: no return
        assert False
